const {getCurrentTime} = require('./utils')

function successData(res, data) {
  let success = {data: data, code: 0}
  console.log(`response back success==========>>>${getCurrentTime()} data=>${JSON.stringify(success)}<<<==========`)
  res.json(success)
}

function errorData(res, msg) {
  let error = {code: 1, msg, data: null}
  console.log(`response back error==========>>>${getCurrentTime()} data=>${JSON.stringify(error)}<<<==========`)
  res.json(error)
}

module.exports = {
  successData,
  errorData
}
